package com.spring.main.aop;

import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class DemoAspect {

    private final Logger log = LoggerFactory.getLogger(this.getClass());

    @Pointcut(value = "execution(* com.spring.main.aop.DemoImpl.demo())")
    public void doPointcut() {

    }

    @Before(value = "doPointcut()")
    public void doBefore() {
        log.info("开始");
    }

    @After(value = "doPointcut()")
    private void doAfter() {
        log.info("结束");
    }
}
